import request from '@/utils/request'

export function login(data) {
  return request({
    url: `/ydyz/login.php`,
    method: 'post',
    data: data
  })
}


export function getInfo(token) {
  return request({
    url: '/api/crm/auth/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/api/crm/auth/logout',
    method: 'delete'
  })
}



export function dept(pid) {
  return request({
    url: `/api/crm/dept?${pid}size=100`,
    method: 'get'
  })
}


export function users(pageSize, page, search) {
  return request({
    url: `/ydyz/query_users.php?page=${page}&limit=${pageSize}&username=${search}`,
    method: 'get'
  })
}

export function all() {
  return request({
    url: `/api/crm/roles/all`,
    method: 'get'
  })
}

export function addUsers(data) {
  return request({
    url: `/ydyz/create_user.php`,
    method: 'post',
    data: data
  })
}


export function resetPwd(data) {
  return request({
    url: `/api/crm/users/resetPwd`,
    method: 'put',
    data: data
  })
}

export function roles(data) {
  return request({
    url: `/api/crm/users`,
    method: 'delete',
    data: data
  })
}


export function updateUserDept(data) {
  return request({
    url: `/api/crm/users/updateUserDept`,
    method: 'post',
    data: data
  })
}